namespace YM {
    export function log(...arg: any[]) {
        if (logSwitchBool) {
            // arg.forEach((s, index) => {
            //     if (typeof s == "object") {
            //         try {
            //             arg[index] = JSON.stringify(s);
            //         }
            //         catch (e) {
                        
            //         }
            //     }
            // })
            console.log.apply(console,arg);
        }

    }
    export function logError(message?: string, ...optionalParams: any[]) {
        if (logSwitchBool)
        console.error(message, ...optionalParams);
    }
    export function logEception(message?: string, ...optionalParams: any[]) {
        if (logSwitchBool)
        console.exception(message, ...optionalParams);
    }
    export function logWarn(...data:any[]){
        console.warn(data);
    }
    var logSwitchBool: boolean = true;
    export function logOn(logSwitch: boolean) {
        logSwitchBool = logSwitch;
    }
}